home *** CD-ROM | disk | FTP | other *** search
/ Risc World 3 / Risc World 3.iso / SOFTWARE / ISSUE6 / PD / PDF / GuiLib / Task / h / GuiWindow < prev   
Text File  |  2003-02-14  |  4KB  |  100 lines

  1. //--------------------------------------------------------------------------
  2. //
  3. //   Copyright (c) 2002, Colin Granville
  4. //
  5. //   All rights reserved.
  6. //
  7. //   Redistribution and use in source and binary forms, with or
  8. //   without modification, are permitted provided that the following 
  9. //   conditions are met:
  10. //
  11. //      * Redistributions of source code must retain the above copyright 
  12. //        notice, this list of conditions and the following disclaimer.
  13. //
  14. //      * Redistributions in binary form must reproduce the above 
  15. //        copyright notice, this list of conditions and the following 
  16. //        disclaimer in the documentation and/or other materials 
  17. //        provided with the distribution.
  18. //
  19. //      * The name Colin Granville may not be used to endorse or promote 
  20. //        products derived from this software without specific prior 
  21. //        written permission.
  22. //
  23. //   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
  24. //   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
  25. //   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
  26. //   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
  27. //   COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
  28. //   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
  29. //   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
  30. //   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
  31. //   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
  32. //   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
  33. //   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
  34. //   OF THE POSSIBILITY OF SUCH DAMAGE.
  35. //
  36. //--------------------------------------------------------------------------
  37.  
  38. #ifndef GuiWindow_h
  39. #define GuiWindow_h
  40.  
  41. #include "GuiObject.h"
  42. #include "GuiWimp.h"
  43.  
  44. struct GuiKeyboardShortcut
  45. {
  46.   unsigned int  flags;
  47.   int           wimpKeyCode;
  48.   int           keyEvent;
  49.   char          *keyShow;
  50. };
  51.  
  52. class GuiWindow : public GuiWindowObject
  53.   public:
  54.     enum {SwiChunkBase = 0x82880};
  55.     GuiWindow(const char* win) : GuiWindowObject(win) {}
  56.     GuiWindow(GuiObjectId id) : GuiWindowObject(id) {}
  57.     virtual ~GuiWindow();
  58.  
  59.     GuiObjectId     underlyingWindowId() const;
  60.     int             wimpHandle() const                    {return getValue(0);}
  61.     void            setTitle(const char* title)                {setString(11,title);}
  62.     string          getTitle() const                           {return getString(12);}
  63.     void            setExtent(const GuiBBox& extent)           {setValue(15,&extent);}
  64.     bool            getExtent(GuiBBox& extent) const           {return getValue(16,&extent);}
  65.     void            forceRedraw(const GuiBBox& redraw_box)     {setValue(17,&redraw_box);}
  66.  
  67.     bool            getState(GuiGetWindowStateBlock& ws) const;
  68.     bool            update(GuiRedrawWindowBlock&,int& more) const;
  69.     bool            getOutline(GuiBBox&) const;
  70.  
  71.     static _kernel_oserror* redraw(GuiRedrawWindowBlock& rwb,int &more);
  72.     static _kernel_oserror* getRectangle(GuiRedrawWindowBlock& rwb,int &more);
  73.  
  74.     class HasBeenHidden : public GuiToolboxEventHeader
  75.     {
  76.       public:
  77.           enum {Event = SwiChunkBase+0x10};
  78.     };
  79.  
  80.   private:
  81.  
  82.     GuiWindow(const GuiWindow&);            //prevent copying - not defined
  83.     GuiWindow& operator=(const GuiWindow&); //prevent copying - not defined
  84. };
  85.  
  86. //*****************************************************************************
  87.  
  88. inline _kernel_oserror* GuiWindow::redraw(GuiRedrawWindowBlock& rwb,int &more)
  89. {
  90.   return _swix(Wimp_RedrawWindow,_IN(1) | _OUT(0),&rwb,&more);
  91. }
  92.  
  93. inline _kernel_oserror* GuiWindow::getRectangle(GuiRedrawWindowBlock& rwb,int &more)
  94. {
  95.   return _swix(Wimp_GetRectangle,_IN(1) | _OUT(0),&rwb,&more);
  96. }
  97.  
  98. #endif
  99.